#@layout()
#define main()
<h1>用户管理&nbsp;&nbsp;
    #if(session.user.role==0)
    <a href="/user/add">创建用户</a>
    #end
</h1>
#include("_search.html")
<div class="table_box">
    <table class="list">
        <tbody>
        <tr>
            <th width="4%" style="text-align:center;">id</th>
            <th width="35%" style="text-align:center;">帐号名</th>
            <th width="35%" style="text-align:center;">角色</th>
            <th width="35%" style="text-align:center;">操作</th>
        </tr>

        #for(x : userPage.getList())
        <tr>
            <td style="text-align:center;">#(x.id)</td>
            <td style="text-align:center;">#(x.hm)</td>
            <!--<td style="text-align:center;">#(x.role == 1 ? "租户":"系统管理员")</td>-->
            <td style="text-align:center;">
                #if(x.role==1)
                    租户
                #else if(x.role==2)
                    房东
                #else
                    系统管理员
                #end
            </td>
            <td style="text-align:center;">
                #if(session.user.role == 0)
                    &nbsp;&nbsp;<a href="/user/delete/#(x.id)">删除</a>
                    &nbsp;&nbsp;<a href="/user/edit/#(x.id)">修改</a>
                    &nbsp;&nbsp;<a href="/user/changepwd/#(x.id)">修改密码</a>
                #else
                    &nbsp;&nbsp;<a href="/user/edit/#(x.id)">修改</a>
                    &nbsp;&nbsp;<a href="/user/changepwd/#(x.id)">修改密码</a>
                #end
            </td>
        </tr>
        #end
        </tbody>
    </table>
    #@paginate(userPage.pageNumber, userPage.totalPage, "/user/")
</div>
#end